	    var cj;
	    var yd;
	    var shijian;
	    var i=0;
	    var cg=0;
	    var sb=0;
	    var sd=0;
	    var num=30;
	    var sum=60;
	    var num1=10;
	    function kaishi(){
	    
	    clearInterval(cj);
	    clearInterval(yd);
	    clearInterval(shijian);
	    cj=setInterval("chuangJian()",500);
	    yd=setInterval("yidong()",100);
	    var sp1=document.getElementById("sp1");
	    shijian=setInterval(function(){
	    	sp1.innerHTML=i;
	    	i++
	    },1000);
	    var lanzi1=document.getElementById("lanzi1")
//	    console.log(lanzi1.children.length)
	    	for(var i=1;i<lanzi1.children.length;i++){
	    		lanzi1.children[i].style.display="none"
	    	};
	    };
	    function zanting(){
	    	clearInterval(cj);
	    	clearInterval(yd);
	    	clearInterval(shijian);
	    	
	    };
	    function jieshu(){
	    	clearInterval(cj);
	    	clearInterval(yd);
	    	clearInterval(shijian);
			var div=document.getElementById("shang");
	    	div.innerHTML="";
	        var sp1=document.getElementById("sp1");
	    	sp1.innerHTML="0";
	    	 var sp2=document.getElementById("sp2");
	    	sp2.innerHTML="0";
	    	var sp3=document.getElementById("sp3");
	    	sp3.innerHTML="0";
	    	var sp4=document.getElementById("sp4");
	    	sp4.innerHTML="0";
	    	i=0;
	    	sb=0;
	    	cg=0;
	    	su=0;
	    	 var lanzi1=document.getElementById("lanzi1")
//	    console.log(lanzi1.children.length)
	    	for(var i=1;i<lanzi1.children.length;i++){
	    		lanzi1.children[i].style.display="none"
	    	};	
	    	
	    };
		function chuangJian(){
			var div=document.getElementById("shang");
			var ping=document.createElement("div");
			ping.style.top=10+"px"
			ping.style.left=parseInt(Math.random()*700 + 10)+"px"
			var zimu = parseInt(Math.random() * 26) + 65
			ping.innerHTML="&#"+zimu+";"
			div.appendChild(ping);
			ping.setAttribute("shuzhi", zimu);
			
		};
		function yidong(){
			var div=document.getElementById("shang");
			for(var i=0;i<div.children.length;i++){
				var t = parseInt(div.children[i].style.top);
				t+=num1;
				div.children[i].style.top=t+"px"
				if(t>=360){
					div.children[i].className="pingguo";
					div.children[i].innerHTML="";
					
				}
				if(t==400){
						div.removeChild(div.children[i]);
						sb++;
					    var sp3=document.getElementById("sp3");
	                    sp3.innerHTML=sb;
	                    if(sb>num){
					    alert("多多练习哦");
					    jieshu();
				        };
				        
				};
			};
		};

		function delapple(e){
//		    var theEvent = window.event || arguments.callee.caller.arguments[0];
//			var dazi=event.keyCode  
       //   var dazi;
//		if(window.e) // IE
//        {
//         dazi = e.keyCode
//        }
//        else if(e.which) // Netscape/Firefox/Opera
//        {
//        dazi= e.which
//        }
			e = e ? e : window.event;
					var dazi = e.which ? e.which : e.keyCode;
            
			var div=document.getElementById("shang");
			for(var i=0;i<div.children.length;i++){
				var zimu = div.children[i].getAttribute("shuzhi");
				if(dazi==zimu){
						div.removeChild(div.children[i]);
						cg++;
						if(cg%20==0){
							var cgnum=cg/20;
							document.getElementById("lanzi1").children[cgnum].style.display="block"
						}
						var sp2=document.getElementById("sp2");
	                    sp2.innerHTML=cg;
	                    var sp4=document.getElementById("sp4");
	                    sd=parseInt(cg/shijian);
	                    sp4.innerHTML=sd; 
                        if(cg==sum){
					    alert("恭喜闯关成本");
					    jieshu();
				        };
				       
						break;
						
				};
				
			};
		};
		function shezhi(){
			var shezhi=document.getElementById("shezhi");
			shezhi.style.display="block";
			zanting();
		}
		function liandong(){
			var sel1=document.getElementById("sel1");
			var sz22=document.getElementById("sz22");
			var sz33=document.getElementById("sz33");
			if(sel1.value==1){
				sz22.value=60;
				sz33.value=30;
			};
			if(sel1.value==2){
				sz22.value=120;
				sz33.value=20;
			};
			if(sel1.value==3){
				sz22.value=180;
				sz33.value=10;
			};
		};
		function queding(){
			
			var sel1=document.getElementById("sel1");
			if(sel1.value==1){
				num=30;
				sum=60;
				num1=10;
			};
			if(sel1.value==2){
				sum=120;
				num=20;
				num1=20;
			};
			if(sel1.value==3){
				sum=180;
				num=10;
				num1=30;
			};
			var shezhi=document.getElementById("shezhi");
			shezhi.style.display="none";
			jieshu();
			kaishi();
		};
		function quxiao(){
			var shezhi=document.getElementById("shezhi");
			shezhi.style.display="none";
			kaishi();
		};
		function moren(){
			
			var sel1=document.getElementById("sel1");
			    sel1.value=1
				sum=60;
				num=30;
			    num1=10;
			var shezhi=document.getElementById("shezhi");
			shezhi.style.display="none";
			jieshu();
			kaishi();
		};
			
